package exam.zte.S2;

import java.util.*;

public class Main {

    public static int n;
    public static int[] price;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String[] ss = s.split(" ");
        n = ss.length;
        price = new int[n];
        for (int i = 0; i < n; i++)
            price[i] = Integer.parseInt(ss[i]);
        System.out.println(solution());
    }

    private static int solution() {
        int dp0 = 0, dp1 = -price[0];
        for (int i = 1; i < n; i++) {
            int t = Math.max(dp0, dp1 + price[i]);
            dp1 = Math.max(dp1, dp0 - price[i]);
            dp0 = t;
        }
        return dp0;
    }
}